#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :RSA解密.py
# @Time      :2024/4/12 15:20
# @Author    :Sherlock
import base64
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5

with open("private_key.pem", "rb") as f:
    private_key = RSA.importKey(f.read())


def decrypt_(cipher_text):
    cipher_text = base64.b64decode(cipher_text.encode())
    cipher = PKCS1_v1_5.new(private_key)
    plain_text = cipher.decrypt(cipher_text, None)
    return plain_text.decode()


cipher_text = "j24qWVIELqbPTesfMaXO7aMJ3AoOQK6Qu+fWbNS219U3pJC7FhSbAxTppBd1YGVXSkU0PhqYOumu0mKpcd8q56XCQQTYsmUsqx5YPa1NA8Ns/axSH2QocHA2rKUqHwU++CS/yRIU14rKSFrhtpICMo6915M+yoWXmQFFp4FhOTo="  # 替换为加密后的内容
decrypted_text = decrypt_(cipher_text)
print(decrypted_text)
